package cn.edu.hqu.cst.android.cxy.test3;

import androidx.appcompat.app.AppCompatActivity;

import android.content.res.Configuration;
import android.os.Bundle;
import android.widget.TextView;

public class SystemInformation extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_system_information);
        TextView screen = findViewById(R.id.text1);
        TextView navigation = findViewById(R.id.text2);
        TextView touch = findViewById(R.id.text3);
        TextView mnc = findViewById(R.id.text4);
        TextView locale = findViewById(R.id.text5);
        Configuration cfg = getResources().getConfiguration();
        if(cfg.orientation == Configuration.ORIENTATION_LANDSCAPE){
            screen.setText("横向屏幕");
        }
        else{
            screen.setText("竖向屏幕");
        }
        mnc.setText("网络码："+ cfg.mnc);
        locale.setText("当前locale：" + cfg.locale);
        if(cfg.orientation == Configuration.NAVIGATION_NONAV){
            navigation.setText("没有导航，即方向控制");
        }
        else if(cfg.orientation == Configuration.NAVIGATION_DPAD){
            navigation.setText("DPAD导航，即方向键控制方向");
        }
        else if(cfg.orientation == Configuration.NAVIGATION_UNDEFINED) {
            navigation.setText("滚轮导航,即滚轮控制方向");
        }
        else{
            navigation.setText("轨迹球导航，即轨迹球控制方向");
        }
        if(cfg.orientation == Configuration.TOUCHSCREEN_NOTOUCH){
            touch.setText("无触摸屏");
        }
        else{
            touch.setText("支持触摸屏");
        }
    }
}